package com.wxhandle.cleandemo.persistence.repositorys.identity;

import com.wxhandle.cleandemo.core.domain.identity.SysUser;
import com.wxhandle.cleandemo.persistence.repositorys.DefaultRepository;

import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Repository;

@Repository
public interface SysUserRepository extends DefaultRepository<SysUser, Long>{
   
    /**
     * sql版查询用户示例，手动sql代码拼接
     * @param login
     * @return
     */
    @Query(value="select u from SysUser u where u.name=?1")
    SysUser findLogin(String login);

    /**
     * 申明按name查询用户，自动实现
     * @param name 用户名
     * @return
     */
    SysUser findByName(String name);
}
